#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[4];
    memset(a, 0, sizeof a);
    int k = 0, i = -1;
    while (n)
    {
        k ++;
        i ++;
        if (k % 7 == 0 || to_string(k).find('7') != -1) a[i % 4] ++;
        else n --;
    }
    
    for (int i = 0 ; i < 4 ; i ++)
        cout << a[i] << endl;
    
    return 0;
}
